<?php 
// Lay cac thong so cau hinh chung
include "../../app_global.php";
// Lay cac hang so dung chung
include "../../const.php";
// Ham thuc hien lay ten file va hien thi noi dung
include "../../isa-lib/isa-function/isa_public_function.php";
require_once("../../isa-lib/nusoap/nusoap.php");
include "../../isa-lib/isa-function/prax.php";
include "../../list/recordtype/handler_function.php";
include "handler_function.php";
// Kiem tra NSD da login hay qua timeout chua
include "../../test_login.php";
include "../../connect.php";
include "../../connect_ado.php";
// Khoi tao cac bien SESSION chua quyen modul, function cua NSD
include "../../init_session.php";
// Lay cac thong so cau hinh rieng cho chuc nang nay
include "../../onegate_function.php";
include_once("../../isa-lib/isa-function/class_xslt.php");//Khai bao su dung cac ham dung chung 
include "../receive/const.php";
include "app_local.php";
include "const.php";
include_once $FOLDER_DEVEDIT_CLASS;
?>	
<script src="../../isa-lib/isa-js/isa_util.js" ></script>
<script src="../receive/js_record.js" ></script>
<script src="../js-record/js_technology_ajax.js" ></script>
<?php
$v_worktype_id = "";
if(isset($_REQUEST['v_worktype_code'])){
	$v_worktype_id = _replace_bad_char(trim($_REQUEST['v_worktype_code']));
}
$strHTML = "";
if(_is_sqlserver()){//CSDL MSSQL 
	if($v_worktype_code <> ""){
		$sql = "Exec Onegate_WorkTypeAttachFileGetAll " . "'" .$v_worktype_id . "'";
		$arr_all_file = _adodb_query_data_in_name_mode($sql);
		$v_count_file = sizeof($arr_all_file);
		$strHTML = "<table class='list_table2' width='100%' cellpadding='0' cellspacing='0'>";
		$strHTML = $strHTML . "<col width='5%'><col width='95%'>";
		for ($i = 0; $i<$v_count_file; $i++) {
			$v_file_id = $arr_all_file[$i]['PK_WORKTYPE_FILE'];
			$v_file_name = $arr_all_file[$i]['C_FILE_NAME']; 
			$v_file_url = trim(_CONST_UPLOAD_IMAGE_URL_PATH_VIEW). $v_file_name;
			$v_goto_url = "javascript:filename_onclick(&quot;T_ONEGATE_WORKTYPE_FILE&quot;,&quot;PK_WORKTYPE_FILE&quot;,&quot;C_FILE_NAME&quot;,&quot;C_FILE_CONTENT&quot;," . strval($v_file_id) . ",&quot;".$v_file_url."&quot;);" ;
			$target = "";	
			$v_inc = $i+1;
			$strHTML = $strHTML . "<tr><td>$v_inc.</td><td><a href='$v_goto_url' class='normal_link' $target>$v_file_name</a></td></tr>";
		}
		$strHTML = $strHTML . "</tr></table>";	
	}	
	echo $strHTML;	
}		
?>	
	
